<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../common.inc" %>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/style1.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="./js/FusionCharts.js"></script>
<script language="JavaScript" src="./js/sale-monitor_demo.js"></script>
<script type="text/javascript" src="./js/form.js"></script>
<script type="text/javascript">

function createReport(){
	
	document.newsNoticeForm.action = "./manageReport.do?action=annualWreathCompares";
	document.newsNoticeForm.target = "main";
	document.newsNoticeForm.submit();
	
}
function back(){
	window.location.href = "./manageReport.do";
	window.location.target = "main";
}
function changeImg(id){
	if(id == 1){
		document.getElementById("img1").className = "btn_back";
		document.getElementById("img2").className = "btn_submit";
		document.getElementById("img3").className = "btn_submit";
		document.getElementById("img4").className = "btn_submit";
		document.getElementById("img5").className = "btn_submit"; 
		document.getElementById("div1").style.display = "block";
		document.getElementById("div2").style.display = "none";
		document.getElementById("div3").style.display = "none";
		document.getElementById("div4").style.display = "none";
		document.getElementById("div5").style.display = "none";
	}else if(id == 2){
		document.getElementById("img2").className = "btn_back";
		document.getElementById("img1").className = "btn_submit";
		document.getElementById("img3").className = "btn_submit";
		document.getElementById("img4").className = "btn_submit";
		document.getElementById("img5").className = "btn_submit"; 
		document.getElementById("div2").style.display = "block";
		document.getElementById("div1").style.display = "none";
		document.getElementById("div3").style.display = "none";
		document.getElementById("div4").style.display = "none";
		document.getElementById("div5").style.display = "none";
	}else if(id == 3){
		document.getElementById("img3").className = "btn_back";
		document.getElementById("img1").className = "btn_submit";
		document.getElementById("img2").className = "btn_submit";
		document.getElementById("img4").className = "btn_submit";
		document.getElementById("img5").className = "btn_submit"; 
		document.getElementById("div3").style.display = "block";
		document.getElementById("div1").style.display = "none";
		document.getElementById("div2").style.display = "none";
		document.getElementById("div4").style.display = "none";
		document.getElementById("div5").style.display = "none";
	}else if(id == 4){
		document.getElementById("img4").className = "btn_back";
		document.getElementById("img3").className = "btn_submit";
		document.getElementById("img1").className = "btn_submit";
		document.getElementById("img2").className = "btn_submit";
		document.getElementById("img5").className = "btn_submit"; 
		document.getElementById("div4").style.display = "block";
		document.getElementById("div1").style.display = "none";
		document.getElementById("div2").style.display = "none";
		document.getElementById("div3").style.display = "none";
		document.getElementById("div5").style.display = "none";
	}else if(id == 5){
		document.getElementById("img5").className = "btn_back";
		document.getElementById("img3").className = "btn_submit";
		document.getElementById("img1").className = "btn_submit";
		document.getElementById("img2").className = "btn_submit";
		document.getElementById("img4").className = "btn_submit";
		document.getElementById("div5").style.display = "block";
		document.getElementById("div1").style.display = "none";
		document.getElementById("div2").style.display = "none";
		document.getElementById("div3").style.display = "none";
		document.getElementById("div4").style.display = "none";
	}
}
		var industrysthis = new Array();
		<c:forEach items="${all}" var="item" varStatus="s" >
			<c:choose>
			<c:when test="${!empty item.thisnewcustomercount}">
			industrysthis.push(${item.thisnewcustomercount});
			</c:when>
			<c:otherwise>
			industrysthis.push(0);
			</c:otherwise>
			</c:choose>
		</c:forEach>
		var industrysthis1 = new Array();
		<c:forEach items="${all}" var="item" varStatus="s" >
			<c:choose>
			<c:when test="${!empty item.thismonthnewcontractcount}">
			industrysthis1.push(${item.thismonthnewcontractcount});
			</c:when>
			<c:otherwise>
			industrysthis1.push(0);
			</c:otherwise>
			</c:choose>
		</c:forEach>
		var industrysthis2 = new Array();
		<c:forEach items="${all}" var="item" varStatus="s" >
			<c:choose>
			<c:when test="${!empty item.thismonthtotalcontractCost}">
			industrysthis2.push(${item.thismonthtotalcontractCost});
			</c:when>
			<c:otherwise>
			industrysthis2.push(0);
			</c:otherwise>
			</c:choose>
		</c:forEach>
		var industrysthis3 = new Array();
		<c:forEach items="${all}" var="item" varStatus="s" >
			<c:choose>
			<c:when test="${!empty item.thismonthtotalbackCost}">
			industrysthis3.push(${item.thismonthtotalbackCost});
			</c:when>
			<c:otherwise>
			industrysthis3.push(0);
			</c:otherwise>
			</c:choose>
		</c:forEach>

		var t1 = new Array();
		var t2 = new Array();
		var t3 = new Array();
		var t4 = new Array();
		<c:forEach items="${all}" var="item" varStatus="s" >
			t1.push(${item.aroundaddedPecentnewcustomercount});
		</c:forEach>
		<c:forEach items="${all}" var="item" varStatus="s" >
			t2.push(${item.aroundaddedPecentmonthnewcontractcount});
		</c:forEach>
		<c:forEach items="${all}" var="item" varStatus="s" >
			t3.push(${item.aroundaddedPecentmonthtotalcontractCost});
		</c:forEach>
		<c:forEach items="${all}" var="item" varStatus="s" >
			t4.push(${item.aroundaddedPecentmonthtotalbackCost});
		</c:forEach>
		function aaa(aaa){
			window.location.href = aaa;
			window.location.target = "main";
			}
</script>
</head>
<body>
<form name="newsNoticeForm" action="" method="post">
<table class="table_frame">
		<tr>
			<td>
				<table class="table_title2">
					<tr>
						<td>
							<table cellpadding="0" cellspacing="0" width="100%" height="100%">
								<tr>
									<td class="title_lab">分析报表</td>
									<td align="left">&nbsp;&nbsp;快速查看：
									<select onchange="aaa(this.options[this.selectedIndex].value);">
									<option>-------------请选择-------------</option>
									<option value="./manageReport.do?action=preSalePeriodReport">销售周期分析表</option>
									<option value="./manageReport.do?action=saleMonthReport">销售月度统计表</option>
									<option value="./manageReport.do?action=allCustomerDevoteAnalysis">客户贡献统计表</option>
									<option value="./manageReport.do?action=oldCustomerDevoteAnalysis">老客户贡献分析表</option>
									<option value="./manageReport.do?action=marketExpandsAnalysis">市场开拓同步分析表</option>
									<option value="./manageReport.do?action=annualWreathCompares">年度环比分析表</option>
									<option value="./manageReport.do?action=getLinkManMailInfo">联系人邮件列表</option>
									<option value="./manageReport.do?action=CustomerStatisticContract">按客户统计合同</option>
									<option value="./manageReport.do?action=saleStatisticContract">按销售统计合同</option>
									
									</select></td>
								</tr>
							</table>
						</td>
					</tr>
					
					<tr><td style="height: 55px;text-align: center;font-weight: bold;font-size: 24px;">年度环比分析表</td></tr>
					<tr>
						<td>
							<table align="center" class="table_report1">
										
										<tr>
						<td class="title" align="right">选择年度:</td>
						<td class="title">
							<select name="currentYear" id="currentYear">
								<option value="">默认当前年度</option>
								
								<option value="2005" <c:if test="${currentYear == 2005}">selected</c:if> >------2005------</option>
								<option value="2006" <c:if test="${currentYear == 2006}">selected</c:if> >------2006------</option>
								<option value="2007" <c:if test="${currentYear == 2007}">selected</c:if> >------2007------</option>
								<option value="2008" <c:if test="${currentYear == 2008}">selected</c:if> >------2008------</option>
								<option value="2009" <c:if test="${currentYear == 2009}">selected</c:if> >------2009------</option>
								<option value="2010" <c:if test="${currentYear == 2010}">selected</c:if> >------2010------</option>
								<option value="2011" <c:if test="${currentYear == 2011}">selected</c:if> >------2011------</option>
								<option value="2012" <c:if test="${currentYear == 2012}">selected</c:if> >------2012------</option>
								<option value="2013" <c:if test="${currentYear == 2013}">selected</c:if> >------2013------</option>
								<option value="2014" <c:if test="${currentYear == 2014}">selected</c:if> >------2014------</option>
								<option value="2015" <c:if test="${currentYear == 2015}">selected</c:if> >------2015------</option>
							</select>
						</td>
						</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td align="center">
							<table class="table_report1" cellpadding="0" cellspacing="0" height="100%" style="width: 95%;">
								<tr>
									<td align="center" height="30">
										<input class="btn_report" type="button" value="" onclick="createReport()"/>&nbsp;&nbsp;
										<button class="btn_back" onclick="back()" hidefocus="true">返回</button>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td align="center">
							<table class="table_sreport" style="width: 95%;">
								<tr>
									<td class="title"></td>
									<td colspan="4" class="title" align="center">
									<c:choose>
									<c:when test="${!empty currentYear }">
									${currentYear }
									</c:when>
									<c:otherwise>
									${thisYear }
									</c:otherwise></c:choose>年度
									</td>
									<td colspan="4" class="title" align="center">环比增幅</td>
								</tr>
								<tr>
									<td class="title">月度</td>
									<td class="title">新增客户</td>
									<td class="title">新增合同</td>
									<td class="title">签约金额</td>
									<td class="title">回款</td>
									<td class="title">新增客户</td>
									<td class="title">新增合同</td>
									<td class="title">签约金额</td>
									<td class="title">回款</td>
								</tr>
								<c:forEach items="${all}" var="item">
								<tr onmouseover="onmousemoveChange(this,'img${item.monthId}')" onmouseout="onmouseoutChange(this,'img${item.monthId}')">
									<td>${item.monthId }月</td>
									<td>
										<c:choose>
											<c:when test="${!empty item.thisnewcustomercount}">
												${item.thisnewcustomercount }
											</c:when>
											<c:otherwise>
												0
											</c:otherwise>
										</c:choose>
										</td>
										<td>
										<c:choose>
											<c:when test="${!empty item.thismonthnewcontractcount}">
												${item.thismonthnewcontractcount }
											</c:when>
											<c:otherwise>
												0
											</c:otherwise>
										</c:choose>
										</td>
										
										<td>￥<c:choose>
												<c:when test="${!empty item.thismonthtotalcontractCost}">
													<fmt:formatNumber value="${item.thismonthtotalcontractCost }" pattern="###,###,###,###.##"/>
												</c:when>
												<c:otherwise>
													0
												</c:otherwise>
											</c:choose>
										</td>
										<td>￥<c:choose>
												<c:when test="${!empty item.thismonthtotalbackCost}">
													<fmt:formatNumber value="${item.thismonthtotalbackCost }" pattern="###,###,###,###.##"/>
												</c:when>
												<c:otherwise>
													0
												</c:otherwise>
											</c:choose>
										</td>
									<td>${item.aroundaddedPecentnewcustomercount }%</td>
									<td>${item.aroundaddedPecentmonthnewcontractcount }%</td>
									<td>${item.aroundaddedPecentmonthtotalcontractCost }%</td>
									<td>${item.aroundaddedPecentmonthtotalbackCost }%</td>
								</tr>
								</c:forEach>
								<tr>
									<td>合计</td>
									<td>${totalcustomerT.totalnewcustomercount }个</td>
										<td>${totalcontractT.yearnewcustomercount }份</td>
										<td>
										￥<c:choose>
												<c:when test="${!empty totalcontractT.yeartotalcontractCost || totalcontractT.yeartotalcontractCost != 0}">
													<fmt:formatNumber value="${totalcontractT.yeartotalcontractCost }" pattern="###,###,###,###.##"/>
												</c:when>
												<c:otherwise>
													0
												</c:otherwise>
											</c:choose>
										</td>
										<td>
										￥<c:choose>
												<c:when test="${!empty totalcontractT.yeartotalbackCost || totalcontractT.yeartotalbackCost != 0}">
													<fmt:formatNumber value="${totalcontractT.yeartotalbackCost }" pattern="###,###,###,###.##"/>
												</c:when>
												<c:otherwise>
													0
												</c:otherwise>
											</c:choose>
										</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td class="title_info" style="text-align: center;">图形分析</td>
					</tr>
					<tr>
						<td align="center">
							<table class="table_report1" cellpadding="0" cellspacing="0" height="100%" style="width: 95%;text-align: left;">
								<tr>
									<td align="" height="30">
										<button id="img1" class="btn_back" onclick="changeImg(1)" hidefocus="true">按客户</button>
										<button id="img2" class="btn_submit" onclick="changeImg(2)" hidefocus="true">按合同</button>
										<button id="img3" class="btn_submit" onclick="changeImg(3)" hidefocus="true">按签约金额</button>
										<button id="img4" class="btn_submit" onclick="changeImg(4)" hidefocus="true">按回款</button>
										<button id="img5" class="btn_submit" onclick="changeImg(5)" hidefocus="true">综合</button>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td height="200" align="center" >
							<table class="table" style="width: 95%;text-align: center;">
								<tr>
									<td align="center">
										<div id="div1" style="display: block;">
											<div id="chartdiv11" align="center">按客户</div>
											<script type="text/javascript">
											xianghm3("chartdiv11",industrysthis,"按客户");
											</script>
										</div>
										<div id="div2" style="display: none;">
											<div id="chartdiv22" align="center">按合同</div>
											<script type="text/javascript">
											xianghm3("chartdiv22",industrysthis1,"按合同");
											</script>
										</div>
										<div id="div3" style="display: none;">
											<div id="chartdiv33" align="center">按签约金额</div>
											<script type="text/javascript">
											xianghm3("chartdiv33",industrysthis2,"按签约金额");
											</script>
										</div>
										<div id="div4" style="display: none;">
											<div id="chartdiv44" align="center">按回款</div>
											<script type="text/javascript">
											xianghm3("chartdiv44",industrysthis3,"按回款");
											</script>
										</div>
										<div id="div5" style="display: none;">
										<div id="chartdiv55" align="center">综合</div>
										<script type="text/javascript">
										xianghm2("chartdiv55",t1,t2,t3,t4,null,null,"年度环比分析(综合)");
										</script>
										</div>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	</form>
</body>
</html>